//
//  DrawPageVIew.m
//  drawacartoon
//
//  Created by Ji Hu on 12-8-13.
//  Copyright (c) 2012年 爱辅导. All rights reserved.
//

#import "DrawPageVIew.h"

@implementation DrawPageVIew

-(void)dealloc{
    [_contentPage release];
    [_canvas release];
    [super dealloc];
}

- (id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        // Initialization code
        self.backgroundColor=[UIColor clearColor];
        CGRect childframe = CGRectMake(0, 0, frame.size.width, frame.size.height);
        
        _contentPage = [[Page alloc] initWithFrame:childframe];
        _canvas = [[FloatCanvas alloc] initWithFrame:childframe];
        
        [self addSubview:_contentPage];
        [self addSubview:_canvas];
        
        _canvas.mDispatcher=_contentPage;
    }
    return self;
}

-(void)setTag:(NSInteger)tag{
    [super setTag:tag];
    
    [_contentPage setPage:tag];
}

-(void)loadFromFile{
    [_contentPage loadFromFile];
}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect
{
    // Drawing code
}
*/

@end
